#include "queue.h"
#include <stdio.h>

int main(int argc, char * argv[])
{
    queue_node queue;
    struct entry entry1 = {"entry1"};
    struct entry entry2 = {"entry2"};
    struct entry entry3 = {"entry3"};

    queue_init(&queue);
    printf("---------------------------\n");
    printf("enqueue entry 1, 2, 3\n");
    printf("enqueue entry1\n");
    enqueue(&queue, &entry1);
    printf("enqueue entry2\n");
    enqueue(&queue, &entry2);
    printf("enqueue entry3\n");
    enqueue(&queue, &entry3);

    printf("---------------------------\n");
    printf("dequeue entry 1, 2, 3\n");
    for (int i = 0; i < 3; i++) {
        struct entry * entry = dequeue(&queue);
        printf("dequeue: %s\n", entry->name);
    }
    for (list_node * node = queue.entries.next; node != &queue.entries; node = node->next) {
        struct entry * entry = LIST_ENTRY(node, struct entry);
        printf("name: %s\n", entry->name);
    }

#if 0
    dequeue(&queue);
#endif

    return 0;
}
